<html>
<head><meta charset="utf-8"><title>-Z normalize-docs #81091 · rustdoc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/index.html">rustdoc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html">-Z normalize-docs #81091</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="234332402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234332402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234332402">(Apr 13 2021 at 14:13)</a>:</h4>
<blockquote>
<p>I'm unclear on many parts yet but I guess most importantly unclear on with this change, how would the rustdoc feature work after I had managed to fix this...? would the docs just have the full, unbound path like &lt;Source as SelectDsl&gt;::Output for the type Select&lt;Source&gt; in your minimization <a href="https://github.com/rust-lang/rust/issues/79459#issuecomment-734984867">https://github.com/rust-lang/rust/issues/79459#issuecomment-734984867</a> ?</p>
</blockquote>
<p><span class="user-mention" data-user-id="341229">@Joonas Koivunen</span> Yes - the idea is that if it can't be normalized, it should just fallback to showing the original output</p>



<a name="234332565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234332565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234332565">(Apr 13 2021 at 14:14)</a>:</h4>
<p>if you look at the rustdoc code it actually does that already for you: <a href="https://github.com/jyn514/rust/blob/0679a4cd93db7dfd33b45cd5bd6be52a0f5e894a/src/librustdoc/clean/mod.rs#L1544">https://github.com/jyn514/rust/blob/0679a4cd93db7dfd33b45cd5bd6be52a0f5e894a/src/librustdoc/clean/mod.rs#L1544</a></p>



<a name="234332604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234332604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234332604">(Apr 13 2021 at 14:14)</a>:</h4>
<p>the problem is that <code>normalize</code> is literally calling <code>process::exit</code> so it never gets that far</p>



<a name="234332763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234332763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234332763">(Apr 13 2021 at 14:15)</a>:</h4>
<p>if you change <code>normalize</code> to return an error instead, basically the only change needed is to turn <code>map()</code> into <code>and_then()</code> and ignore the overflow error like all the other errors</p>



<a name="234333617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234333617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234333617">(Apr 13 2021 at 14:20)</a>:</h4>
<p>thank you for working on this! <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="234340347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234340347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234340347">(Apr 13 2021 at 14:55)</a>:</h4>
<p>Great! At least I understood that correctly. So far I've rebased your modifications and yes, like I mentioned, it was quite interesting to see the conflict reasons (there were huge changes merged between now and when you started -- though I guess this is normal).</p>
<p>I should probably push that version in case I never get this done. I still think it's a good possibility since there's just so much ground to cover, or at least it seems like that.</p>
<p>However, the rebased or incomplete version wasn't too clear for me (given the new codebase of rustc), so I started again from a clean <code>master</code> and now I pretty much agree with your changes, except the ones in <code>rustc_trait_selection/src/traits/error_reporting/{mod,suggestions}.rs</code>, but perhaps those can be discussed later.</p>



<a name="234341614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234341614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234341614">(Apr 13 2021 at 15:00)</a>:</h4>
<p>tbh I did those changes while sleeping on a couch in a friends apartment so they may not be my best work <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="234344275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234344275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234344275">(Apr 13 2021 at 15:09)</a>:</h4>
<p>sorry, with unclear I just meant the reasoning(s) behind each change, except for the type system requiring it :) I guess I'll continue working to better trying to understand the second commit. I do understand why the obligation needs to go into the OverflowError, but this commit changed the build errors so drasticly it's going to take some time.</p>
<p>also I linked the rebased version to the issue <a href="https://github.com/rust-lang/rust/issues/81091">rust#81091</a></p>



<a name="234348066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234348066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234348066">(Apr 13 2021 at 15:27)</a>:</h4>
<blockquote>
<p>I do understand why the obligation needs to go into the OverflowError, but this commit changed the build errors so drasticly it's going to take some time.</p>
</blockquote>
<p>yeah this was the point at which I gave up <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> if you find an easier way to do this without storing the obligation I'd definitely be interested</p>



<a name="234349283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234349283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234349283">(Apr 13 2021 at 15:34)</a>:</h4>
<blockquote>
<p>now I pretty much agree with your changes, except the ones in rustc_trait_selection/src/traits/error_reporting/{mod,suggestions}.rs, but perhaps those can be discussed later.</p>
</blockquote>
<p>the reason these don't exit on overflow is this only happens if an error is already going to be reported</p>



<a name="234349338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234349338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234349338">(Apr 13 2021 at 15:34)</a>:</h4>
<p>so the overflow is from generating suggestions, it's unrelated to the actual problem in the code</p>



<a name="234361144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234361144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234361144">(Apr 13 2021 at 16:45)</a>:</h4>
<p>my thinking was  the previous implementation would had stopped on the first overflow, if such would had been found when generating help. however I don't now if such a "double-fault" condition was ever possible. either way, that is probably something which should be visible when it comes to testing this..</p>



<a name="234362043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234362043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234362043">(Apr 13 2021 at 16:50)</a>:</h4>
<p>well yes, but IMO that's the wrong behavior - it means you see an error that's unrelated to what actually went wrong</p>



<a name="234362313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/234362313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#234362313">(Apr 13 2021 at 16:52)</a>:</h4>
<p>that is an excellent point, now that I think about it :)</p>



<a name="235224866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235224866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235224866">(Apr 19 2021 at 18:15)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="341229">@Joonas Koivunen</span> had you made any progress with this? Happy to help if you got stuck :)</p>



<a name="235227327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235227327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235227327">(Apr 19 2021 at 18:33)</a>:</h4>
<p>no progress to report, been a bit busy with daily $work. I'll try to gather my notes/thoughts for tomorrow if I can get some concrete questions.</p>



<a name="235393133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235393133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235393133">(Apr 20 2021 at 18:36)</a>:</h4>
<p>All righty.. sorry for the delay <span class="user-mention" data-user-id="232545">@Joshua Nelson</span> . Been a bit busier than expected as deadlined $work has mysteriously appeared :)</p>
<p>So what I was last looking was the necessity of the obligation you introduced in the <a href="https://github.com/rust-lang/rust/commit/596b1038423dcf07bc1ed8ddc0f6ae8756866600#diff-9c74165e2843a939fdde7bbaa0fb2c029c1db925a1ae178e35dc85cbd8b381e2L256-R256">"everything is broken" commit</a> into <code>rustc_middle::traits::select::OverflowError</code>. This cannot work as is because either the Obligation would have to move from <code>rustc_infer::traits</code> to the middle, or be handled in some other way.</p>
<p>In order the understand the "other possible ways", I started looking at the api surface of <code>rustc_trait_selection</code> and it's quite huge, almost all items seem to be public and I guess I was last left at this point.</p>



<a name="235393517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235393517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235393517">(Apr 20 2021 at 18:39)</a>:</h4>
<p>Looking back into the hints provided on <a href="https://github.com/rust-lang/rust/issues/81091">rust#81091</a> I know realize that perhaps there isn't any reason to expand this outwards from the given <code>rustc_trait_selection::traits::{select,projection}</code>. From the hint in issue description:</p>
<blockquote>
<p>until outside of rustc_trait_selection::traits::{select, project}, at which point they should be emitted.</p>
</blockquote>
<p>emit probably means reporting the error and stopping, similar to what <code>rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt::evaluate_obligation_no_overflow</code> used to do (it's now removed in the branch)?</p>



<a name="235394107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235394107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235394107">(Apr 20 2021 at 18:43)</a>:</h4>
<p>After writing up this status report I feel like I've been sidetracked by following and pondering all of the possible OverflowError returns and instead (or in addition) I should try approach this by going top-down from the API surface of <code>rustc_trait_selection::traits::{select,project}::*</code> which I guess I've ended up looking up the least. Though there has certainly been enough of rustc dev guide to read here as well.</p>
<p>Would the "top-down" sound sensible idea to you, or had you gotten some better idea in the meantime?</p>
<p>Also, sorry for this many messages kind of comms. I'm on +03:00 timezone so we've got a bit of tz difference. I'll be a bit afk now but will check your reply tomorrow at the latest.</p>



<a name="235396564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235396564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235396564">(Apr 20 2021 at 18:58)</a>:</h4>
<p>Oh no worries, I have a tendency to ramble in chats myself <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> I like the idea of doing this top-down. I'd start with where rustdoc calls <code>normalize()</code> - I think that's a query? So any type it returns has to be available in rustc_middle.</p>



<a name="235463248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235463248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235463248">(Apr 21 2021 at 06:49)</a>:</h4>
<p>Ah yes, thanks to your note about it being most likely being a query, I think something clicked -- or at least it feels that way. The query abstraction and the way it's populated are definitely something I haven't yet come across elsewhere not to even mention the incremental side of it.</p>



<a name="235478897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235478897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235478897">(Apr 21 2021 at 09:19)</a>:</h4>
<p>yes so queries are weird because they can be declared and implemented separately</p>



<a name="235478950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235478950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235478950">(Apr 21 2021 at 09:19)</a>:</h4>
<p>you don't have to worry about the incremental part for this, but as long as the argument types and the return types are defined in rustc_middle the funciton itself can be defined anywhere</p>



<a name="235479084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235479084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235479084">(Apr 21 2021 at 09:20)</a>:</h4>
<p>search for <code>provide(</code></p>



<a name="235492040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235492040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235492040">(Apr 21 2021 at 11:18)</a>:</h4>
<p>Trying to move the obligation now, got ... 73 errors next, all <code>OverflowError</code> without <code>'tcx, T</code>. Feels weird writing such a change, as normally I'd want to know very deeply the query system and the incremental parts before moving such a struct into the return value. Lets see what'll happen :)</p>



<a name="235541324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235541324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235541324">(Apr 21 2021 at 16:31)</a>:</h4>
<p>today I started moving Obligation et. al. over to <code>rustc_middle</code>, still a lot of errors. the biggest one is that <code>rustc_middle::traits::SelectionError</code> derives <code>TypeFoldable</code> and <code>Lift</code>. now that I've added <code>SelectionError::Overflow(PredicateOverflow&lt;'tcx&gt;)</code> which is <code>rustc_middle::traits::select::OverflowError&lt;'tcx, ty::Predicate&lt;'tcx&gt;&gt;</code>, I'm not seeing a trivial path to impl the traits by using the derives.</p>
<p>I'm not really certain on any if these, but if you would happen to have already explored the <code>TypeFoldable</code> and <code>Lift</code> derives, is there any point in deriving it for the smaller types which most likely do not have anything to do with typefolding or even lifting (since they are <code>'static</code>). Also, it'd seem that deriving doesn't even work for some reason.</p>



<a name="235542222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235542222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235542222">(Apr 21 2021 at 16:36)</a>:</h4>
<p>hmm maybe this is a sign this is the wrong approach</p>



<a name="235542253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235542253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235542253">(Apr 21 2021 at 16:37)</a>:</h4>
<p>do you remember why I needed to make Obligation part of OverflowError in the first place?</p>



<a name="235626280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235626280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235626280">(Apr 22 2021 at 06:30)</a>:</h4>
<blockquote>
<p>do you remember why I needed to make Obligation part of OverflowError</p>
</blockquote>
<p>not so much as "remember" but my hunch is that if the resolution goes from terminating version to result returning version, the existing call sites which can't handle the OverflowError will need to have the previous reporting, which used to happen like:</p>
<ul>
<li>canonical: re-evaluate root obligation with TraitQueryMode::Standard (expecting it to terminate) or <code>span_bug!</code></li>
<li>standard or canonical with re-evaluation: the actual error reporting happens through:</li>
</ul>
<div class="codehilite"><pre><span></span><code>evaluate_root_obligation (compiler/rustc_trait_selection/src/traits/select/mod.rs)
-&gt; evaluate_predicates_recursively
-&gt; evaluate_predicate_recursively
-&gt; check_recursion_limit
-&gt; report_overflow_error (compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs)
</code></pre></div>
<p>where we'll have:</p>
<div class="codehilite"><pre><span></span><code>match self.query_mode {
    TraitQueryMode::Standard =&gt; {
        self.infcx().report_overflow_error(error_obligation, true);
    }
    TraitQueryMode::Canonical =&gt; {
        // in master this doesn&#39;t have error_obligation
        return Err(OverflowError(error_obligation.to_owned()));
    }
}
</code></pre></div>
<p>So I'd imagine those callsites which cannot handle the Overflow would in future call some new helper to re-evaluate the <code>root_obligation</code>, just called from some <code>unwrap_or_else(|| &lt;here&gt;)</code> (the new helper would have to unconditionally terminate).</p>



<a name="235627065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235627065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235627065">(Apr 22 2021 at 06:41)</a>:</h4>
<blockquote>
<p>hmm maybe this is a sign this is the wrong approach</p>
</blockquote>
<p>I think a "no-op" typefoldable at least might be easy to implement, as there'd be none to typefold over but I do agree with this hunch as:</p>
<ul>
<li>I'm not sure will the new version be satisfactory from design standpoint as we don't yet know how many reportings need to be put back in at the callsites (I don't even know which callsites)</li>
<li>This doesn't yet borrowcheck as it doesn't typeck at all :)</li>
</ul>
<p>I rebased the branch yesterday, and now the HEAD reflects the current state: <a href="https://github.com/koivunej/rust/commit/e14bb0517b6da4e4bd4973bfeb339d522bc864c7">https://github.com/koivunej/rust/commit/e14bb0517b6da4e4bd4973bfeb339d522bc864c7</a></p>



<a name="235637847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235637847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235637847">(Apr 22 2021 at 08:18)</a>:</h4>
<blockquote>
<p>I rebased the branch yesterday, and now the HEAD reflects the current state: <a href="https://github.com/koivunej/rust/commit/e14bb0517b6da4e4bd4973bfeb339d522bc864c7">https://github.com/koivunej/rust/commit/e14bb0517b6da4e4bd4973bfeb339d522bc864c7</a></p>
</blockquote>
<p>I did reorderings to make the diff more readable and force pushed: <a href="https://github.com/koivunej/rust/commit/557f1a029fd87ffad89d6705a233aa83d6eacee6">https://github.com/koivunej/rust/commit/557f1a029fd87ffad89d6705a233aa83d6eacee6</a></p>



<a name="235680603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235680603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235680603">(Apr 22 2021 at 13:51)</a>:</h4>
<blockquote>
<p>So I'd imagine those callsites which cannot handle the Overflow would in future call some new helper to re-evaluate the root_obligation, just called from some unwrap_or_else(|| &lt;here&gt;) (the new helper would have to unconditionally terminate).</p>
</blockquote>
<p>yes, that sounds like a good plan. and that would mean we don't have to add the obligation directly to the error</p>



<a name="235680666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235680666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235680666">(Apr 22 2021 at 13:51)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> - does that sound like about what you were expecting?</p>



<a name="235698642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235698642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joonas Koivunen <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235698642">(Apr 22 2021 at 15:28)</a>:</h4>
<p>And the issue was <a href="https://github.com/rust-lang/rust/issues/81091">rust#81091</a> (for some reason I start to remember this series of digits :D)</p>



<a name="235712222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/-Z%20normalize-docs%20%2381091/near/235712222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/-Z.20normalize-docs.20.2381091.html#235712222">(Apr 22 2021 at 17:00)</a>:</h4>
<p>hmm, I don't think that I was expecting overflow errors to be returned from queries.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>